package com.mindskip.xzs.controller.student;

import com.mindskip.xzs.domain.vo.student.dashboard.IndexVO;
import com.mindskip.xzs.domain.vo.student.dashboard.TaskItemVO;
import com.mindskip.xzs.service.DashboardService;
import com.mindskip.xzs.utility.RestResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("StudentDashboardController")
@RequestMapping(value = "/api/student/dashboard")
public class DashboardController {

    private final DashboardService dashboardService;

    public DashboardController(DashboardService dashboardService) {
        this.dashboardService = dashboardService;
    }

    @PostMapping("/index")
    public RestResponse<IndexVO> index() {

        IndexVO indexVO = dashboardService.index();
        return RestResponse.ok(indexVO);
    }

    @PostMapping("/task")
    public RestResponse<List<TaskItemVO>> task() {

        List<TaskItemVO> taskItemVOList = dashboardService.task();
        return RestResponse.ok(taskItemVOList);
    }
}
